<?php

set_include_path(realpath(dirname(__FILE__).'/../PEAR'). PATH_SEPARATOR . get_include_path());


require_once 'Net/Socket.php';
 
$socket = new Net_Socket() ;

// open connection
$result	= $socket->connect('114.80.135.7', 1232, true, 0.5);

if($socket->isError($result))
{
	var_dump($result->getMessage());
	var_dump($result->getCode());
}
//$socket->setTimeout(1,10);
//$socket->setBlocking(false);

return;


// Send data including linebreak
//$socket->writeLine("String with data");

$socket->write("String with data");

// receive data until linebreak
//$result = $socket->readLine();

// receive a number of data
$result = $socket->read(512);

var_dump($result );
// close connection
$socket->disconnect();